<%@page import="java.util.List"%>
<%@page import="org.free.data.Person"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Tag Search</title>
<link
	href="./../css/jquery-ui.css"
	rel="stylesheet" type="text/css" />
<script
	src="./../js/jquery.min.js"></script>
<script
	src="./../js/jquery-ui.min.js"></script>


<script type="text/javascript">
	$(document).ready(function() {
		$("input#autocomplete").autocomplete({
			source : "/tagbasedchat/searchResult"
		});
	});
	
	
	

	function ask() {
		//alert("calling ");
		var xmlhttp;
		if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp = new XMLHttpRequest();
		} else {// code for IE6, IE5
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				setselectBox(xmlhttp.responseText);

			}
		}
		xmlhttp.open("GET", "/tagbasedchat/chat?ask="+document.getElementById("chatInput").value+"&tag="+document.getElementById("searchText1").value, true);
		xmlhttp.send();
	}
</script>


</head>
<body>
<input id="searchText1" type="hidden" value="<%=request.getParameter("searchText")%>">
<input id="chatInput" type="text" />
<input id="ask" type="button" name="ask" value="ask" onclick="ask()"/>
<%

List<Person> persns = (List<Person>)request.getAttribute("persons");
for (Person person : persns) {
	out.println(person.getUsername());
	out.println(person.getPassword());
}

%>
</html>